package com.woniu.mealsService.controller;


import com.woniu.annotation.RequireRole;
import com.woniu.dto.OrderLogDto;
import com.woniu.mealsService.service.OrderLogService;
import com.woniu.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 订单日志表 前端控制器
 * </p>
 *
 * @author jiang
 * @since 2024年12月09日
 */
@RestController
@RequestMapping("/orderLog")
@Api(tags = "订单日志查询")
public class OrderLogController {
    @Autowired
    private OrderLogService orderLogService;
    @GetMapping("/getOrderLog")
    @ApiOperation(value = "查询订单日志")
    @RequireRole({"商家","学生"})
    public Result<?> getOrderLog(@ApiParam("订单编号") @NotNull String orderId) throws Exception{
        List<OrderLogDto> orderLog = orderLogService.getOrderLog(orderId);
        return Result.getListResult(OrderLogDto.class).setData(orderLog).setCode(200).setMsg("查询成功");
    }
}

